import pandas as pd
import requests
from bs4 import BeautifulSoup

sentence='吃葡萄'
def pinyin(sentence):
    url ='http://qq.ip138.com/wb/wb.asp?querykey={}'.format(sentence)
    web = requests.get(url)
    web.encoding='UTF8'
    soup=BeautifulSoup(web.text)
    word=''
    pyin=''
    for k in soup.select('tr'):
        cc=k.select('p')
        try:
            word = word+cc[0].text +','
            pyin = pyin+cc[2].text +','
        except:
            pass
    print(word)
    print(pyin)
    return word, pyin
